import 'dart:ui';

import 'package:fish_redux/fish_redux.dart';
import 'package:www.znpigai.teacher/global_store/state.dart';

class PracticeState implements GlobalBaseState, Cloneable<PracticeState> {
  String id;
  String title;
  int indexNo; // 序号
  String demand;
  String content;
  String score; // 机器评分，仅用于练习列表中
  String ctime; // 作业创建时间
  int counter; // 批改次数
  String grade; // 年级
  String articleType; // 题材

  PracticeState(
      {this.themeColor,
      this.userInfo,
      this.id,
      this.title,
      this.indexNo,
      this.demand,
      this.content,
      this.score,
      this.ctime,
      this.counter,
      this.grade,
      this.articleType});

  factory PracticeState.fromJson(Map<String, dynamic> json) {
    return PracticeState(
      themeColor: null,
      userInfo: null,
      id: json['id'],
      title: json['title'],
      indexNo: json['indexNo'],
      demand: json['demand'],
      content: json['content'],
      score: json['score'],
      ctime: json['ctime'],
      counter: json['counter'],
      grade: json['grade'],
      articleType: json['articleType'],
    );
  }

  @override
  PracticeState clone() {
    return PracticeState()
      ..themeColor = themeColor
      ..userInfo = userInfo
      ..id = id
      ..title = title
      ..indexNo = indexNo
      ..demand = demand
      ..content = content
      ..score = score
      ..ctime = ctime
      ..counter = counter
      ..grade = grade
      ..articleType = articleType;
  }

  @override
  String toString() {
    return 'PracticeState{title: $title}';
  }

  @override
  Color themeColor;

  @override
  Map<String, dynamic> userInfo;
}
